/* Qualtrics Panel: Friendship & Common Ground Primes */
/* For Magelby Feschrift */  
/* Original Analysis: Spring 2017, This Version: Winter 2020 */ 

use "magelby_replication_data.dta" 

/* Demographics */ 
gen age = 2017 - (Q17 + 1929) if Q17 > 0 & Q17 < 90
summarize age, detail
tabulate Q18 /* gender */
tabulate Q19 /* race*/ 
tabulate Q38 /* children */ 
tabulate Q42 /* region */ 
tabulate Q39 /* marital status */ 
tabulate Q37 /* ideology */ 

/* Survey Dates */ 
/* Extract Completion Day variable */ 
gen finish_date = dofc(V9) 
format finish_date %td 

/* Attention Check */ 
gen attentive  = 0 
replace attentive = 1 if Q40 == 6 
tabulate attentive 
/* 90% pass attention check */ 

/* Party ID */ 
gen pid = . 
replace pid = 1 if Q2 == 1 & Q4 == 1 
replace pid = 2 if Q2 == 1 & Q4 == 2 
replace pid = 3 if Q2 == 3 & Q8 == 1 
replace pid = 4 if Q2 == 3 & Q8 != 1 & Q8 !=2  
replace pid = 5 if Q2 == 3 & Q8 == 2 
replace pid = 6 if Q2 == 2 & Q6 == 2 
replace pid = 7 if Q2 == 2 & Q6 == 1 
tabulate pid 

gen rep = 0
replace rep = 1 if pid > 4 
gen sp = 0 
replace sp = 1 if pid == 1 | pid == 7 
gen pid_strength = abs(pid-4) 


gen libcon = Q37 if Q37 > 0 
gen sorted = 0 
replace sorted = 1 if (pid > 4 & libcon > 4) 
replace sorted = 1 if (pid < 4 & libcon < 4) 
replace sorted = . if libcon == . | pid == . 

gen not_mod = 0 
replace not_mod = 1 if libcon != 4 
replace not_mod = . if libcon == . 


/* Treatment Assignment */ 
gen control = 0 
replace control = 1 if Q113 != . 
gen common = 0 
replace common = 1 if Q57 != . 
gen friend = 0 
replace friend = 1 if Q54 !=. | Q43 != . 
gen treatment  = . 
replace treatment = 0 if control == 1 
replace treatment = 1 if friend == 1 
replace treatment = 2 if common == 1 

/* DVs */ 
gen same_ft = Q53_1 if pid < 4 & Q53_1 > -1 
replace same_ft = Q53_2 if pid > 4 & Q53_1 > -1 
gen other_ft = Q53_2 if pid < 4 & Q53_2 > -1 
replace other_ft = Q53_1 if pid > 4 & Q53_1 > -1 
replace same_ft = . if same_ft == -99 
replace other_ft = . if other_ft == -99
summarize same_ft, detail 
summarize other_ft, detail 
gen ft_pol = same_ft - other_ft 
gen zeroft = 0 
replace zeroft = 1 if other_ft == 0 
replace zeroft = . if other_ft == . 
gen less5 = 0 
replace less5 = 1 if other_ft < 6 
replace less5 = . if other_ft == . 
gen gt50 = 0 
replace gt50 = 1 if other_ft > 49  
replace gt50 = . if other_ft == . 


gen neighbor = (-1*Q28)+5 if Q28 > 0 & pid > 4 
replace neighbor = (-1*Q29)+5 if Q29 > 0 & pid < 4 
gen date = (-1*Q153)+5 if Q153 > 0 & pid > 4 
replace date = (-1*Q26)+5 if Q26 > 0 & pid < 4 


/* Table 1: Feeling Thermometer Ratings */ 
reg other_ft i.treatment 
outreg2 using ft.doc, dec(2) 
reg same_ft i.treatment 
outreg2 using ft.doc, dec(2) 
reg ft_pol i.treatment 
outreg2 using ft.doc, dec(2) 
reg less5 i.treatment 
outreg2 using ft.doc, dec(2) 
reg gt50 i.treatment 
outreg2 using ft.doc, dec(2) 

/* Table 2: Social Distance Measures */ 
reg neighbor i.treatment, robust 
outreg2 using sdm.doc, dec(2) 
reg date i.treatment , robust 
outreg2 using sdm.doc, dec(2) 
reg date i.treatment if Q39 > 0 & Q39 != 2 & Q39 != 6 /* date item, dropping married/cohabiting people */ 
outreg2 using sdm.doc, dec(2) 
tabulate neighbor if treatment == 0 
tabulate date if treatment == 0 
/* Even just looking at the control condition, people just aren't very upset */ 
/* 89% of people are "not at all upset" or "not too upset" about an out-party neighbor, and the equivalent percentage    */ 
/* is 75% for the dating  item. Only 2% and 8% are "very upset" (respectively) --> people aren't that upset */ 
/* the modal answer in both cases is "not at all upset"! */ 


/* Among those who pass the screener */ 
reg other_ft i.treatment if attentive == 1
reg same_ft i.treatment if attentive == 1
reg ft_pol i.treatment if attentive == 1  
reg common_ground i.treatment if attentive == 1, robust 
reg party_agree i.treatment if attentive == 1, robust 
reg neighbor i.treatment if attentive == 1, robust 
reg date i.treatment if attentive == 1, robust /* borderline effects here, but relatively modest */ 
reg date i.treatment if attentive == 1 & Q39 > 0 & Q39 != 2 & Q39 != 6 /* date item, dropping married/cohabiting people */ 
/* no substantive differences */ 

/* Partisan Heterogeneity? */ 
reg other_ft i.treatment##rep 
reg same_ft i.treatment##rep 
reg ft_pol i.treatment##rep  
reg common_ground i.treatment##rep, robust 
reg party_agree i.treatment##rep, robust 
reg neighbor i.treatment##rep, robust 
reg date i.treatment##rep, robust 
reg date i.treatment##rep if Q39 > 0 & Q39 != 2 & Q39 != 6 /* date item, dropping married/cohabiting people */ 
/* no real differences (though same-party FT rating is a bit funky for Reps) */ 

/* Strong Partisans? */ 
reg other_ft i.treatment##sp
reg same_ft i.treatment##sp
reg ft_pol i.treatment##sp  
reg common_ground i.treatment##sp, robust 
reg party_agree i.treatment##sp, robust 
reg neighbor i.treatment##sp, robust 
reg date i.treatment##sp, robust 
reg date i.treatment##sp if Q39 > 0 & Q39 != 2 & Q39 != 6 /* date item, dropping married/cohabiting people */ 
/* no real differences */ 

/* Sorted Respondents */ 
reg other_ft i.treatment##sorted
reg same_ft i.treatment##sorted
reg ft_pol i.treatment##sorted  
reg common_ground i.treatment##sorted, robust 
reg party_agree i.treatment##sorted, robust 
reg neighbor i.treatment##sorted, robust   
reg date i.treatment##sorted, robust 
reg date i.treatment##sorted if Q39 > 0 & Q39 != 2 & Q39 != 6 /* date item, dropping married/cohabiting people */ 
/* no real differences */ 

/* Ideological Moderates */ 
reg other_ft i.treatment##not_mod
reg same_ft i.treatment##not_mod
reg ft_pol i.treatment##not_mod  
reg common_ground i.treatment##not_mod, robust 
reg party_agree i.treatment##not_mod, robust 
reg neighbor i.treatment##not_mod, robust 
reg date i.treatment##not_mod, robust 
reg date i.treatment##not_mod if Q39 > 0 & Q39 != 2 & Q39 != 6 /* date item, dropping married/cohabiting people */ 
/* no real differences */ 

/* Across different metrics, no evidence of sub-group effects etc. Same pattern holds with very minor differences */ 
